﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class usercontrol_Header : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void imgbntsearch_Click(object sender, ImageClickEventArgs e)
    {
        // Xử lý Tìm kiếm sản phầm.
        string keywords = this.txtKeywords.Text.Trim();
        string searchtype = this.ddlSearchType.SelectedItem.Value;
        string gia = this.ddlGia.SelectedItem.Value;
        if (searchtype.Equals("TenSanPham"))
        {
            if (keywords.Equals(""))
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                //keywords = "%" + keywords + "%";
                Response.Redirect("~/Apps/Results.aspx?keys=" + keywords + "&type=" + searchtype + "&price=" + gia);
            }
        }
        else
        {
            //keywords = "%" + keywords + "%";
            Response.Redirect("~/Apps/Results.aspx?keys=" + keywords + "&type=" + searchtype + "&price=" + gia);
        }
    }
    protected void ddlSearchType_SelectedIndexChanged(object sender, EventArgs e)
    {
        // Xử lý khi lựa chọn hình thức tìm kiếm.
        if (ddlSearchType.SelectedValue == "GiaSanPham")
        {
            txtKeywords.Visible = false;
            ddlGia.Visible = true;
        }
    }
}
